<template>
  <div>
    <div v-if="mode === 'DESIGN'">
      <el-button disabled icon="iconfont icon-map-site" type="primary" size="mini" round> 选择部门</el-button>
      <span class="placeholder"> {{placeholder}}</span>
    </div>
    <div v-else>   
       <j-select-depart v-model="_value" :trigger-change="true" customReturnField="orgCode" :multi="multiple" :disabled="disabled" style="max-width: 100%;"></j-select-depart>
    </div>
  </div>
</template>

<script>
import componentMinxins from '../ComponentMinxins'

export default {
  mixins: [componentMinxins],
  name: "DeptPicker",
  components: {},
  props: {
    // value:{
    //   type: Array,
    //   default: () => {
    //     return []
    //   }
    // },
    value:{
      type: String,
    },
    placeholder: {
      type: String,
      default: '请选择部门'
    },
    multiple:{
      type: Boolean,
      default: false
    },
    disabled:{
      type:Boolean,
      default:false
    },
    dictTable: {
      type: String,
      default:'sys_depart'
    },
    dicCode: {
      type: String,
      default: 'org_code'
    },
    dicText: {
      type: String,
      default: 'depart_name'
    },
  },
  data() {
    return {
      showOrgSelect: false,
      depart:null,
    }
  },
  methods: {
    selected(values){
      this.showOrgSelect = false
      this._value = values
    },
    delDept(i){
      this._value.splice(i, 1)
    }
  }
}
</script>

<style scoped>
.placeholder{
  margin-left: 10px;
  color: #adabab;
  font-size: smaller;
}
</style>
